<?php
namespace app\admin\controller;

use app\admin\model\User as UserModel;
use think\Db;

class User extends ApiCommon
{
    public function index()
    {
//        header('Content-Type:application/json; charset=utf-8');
        //exit(json_encode(['code'=>101, 'error'=>'登录已失效']));
        $data = Db::table('admin_user')->select();

        return resultJson(['data'=> $data]);
    }

    public function save(UserModel $userModel)
    {
        $data = $userModel->createUser($this->param);
        if (!$data) {
            return resultJson(['error'=> $userModel->getError()]);
        }

        return resultJson(['data'=> '操作成功']);
    }
}


